// MProgressBar.h: Schnittstelle fr die Klasse MProgressBar.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MPROGRESSBAR_H__4AD0DE49_EF59_4C06_BD8D_63E12F0111C5__INCLUDED_)
#define AFX_MPROGRESSBAR_H__4AD0DE49_EF59_4C06_BD8D_63E12F0111C5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <QtCore>
#include <QtGui>

class MProgressBar : public QLabel
{
    public:
    Q_OBJECT
    Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor DESIGNABLE true)
    Q_PROPERTY(QColor dangerColor READ dangerColor WRITE setDangerColor DESIGNABLE true)
    Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor DESIGNABLE true)
    Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation DESIGNABLE true)
    Q_PROPERTY(double minSafe READ minSafe WRITE setSafeMinimum DESIGNABLE true )
    Q_PROPERTY(double maxSafe READ maxSafe WRITE setSafeMaximum DESIGNABLE true)
    Q_PROPERTY(bool showText READ isTextVisible WRITE setTextVisible DESIGNABLE true)            
    Q_PROPERTY(double value READ value WRITE setValue DESIGNABLE true)        
public:
	MProgressBar(QWidget * parent = 0 );
	virtual ~MProgressBar();
    signals:
        void sig_danger();
        void sig_safe();
protected:
	void paintEvent(QPaintEvent *);

//colours
private:
	QColor m_fillColor;
	QColor m_dangerColor;
	//QColor m_borderColor; <-- WindowText palette role
	//QColor m_backgroundColor; <-- Window palette role - now we can also have a pixmap as background
	QColor m_textColor;
public:
	void setFillColor(const QColor& color){m_fillColor = color;}
    const QColor & fillColor(){ return m_fillColor;}
	//void setBorderColor(const QColor& color){m_borderColor = color;}
	//void setBackgroundColor(const QColor& color){m_backgroundColor = color;}
	void setTextColor(const QColor& color){m_textColor = color;}
    const QColor & textColor(){ return m_textColor;}
	void setDangerColor(const QColor& color){m_dangerColor = color;}
    const QColor & dangerColor(){ return m_dangerColor;}
    bool isTextVisible() { return m_showText; }
//value texts - as QProgressBar
private:
	bool m_showText;
public:
	void setTextVisible(const bool show = true){m_showText = show;}

///orientation - as QProgressBar
private:
	Qt::Orientation m_orientation;
public:
	void setOrientation(Qt::Orientation orientation){m_orientation = orientation; }

/// the value - as QProgressBar
private:
	double m_value;
public slots:
	void setValue(int value);
public:
	double value()const{return m_value;}

//min and max - as QProgressBar
private:
	double m_minimum;
	double m_maximum;
public:
	void setMinimum(const double minimum){m_minimum = minimum;}
	void setMaximum(const double maximum){m_maximum = maximum;}
	double minimum()const {return m_minimum;}
	double maximum()const {return m_maximum;}

///safety tolerance - see setValue(int) for explanation
private:
	bool m_danger;
	void setDanger(const bool danger = true){m_danger = danger;}//could make public - or get rid of it
private:
	double m_minSafe;
	double m_maxSafe;
public:
	void setSafeMinimum(const double value){m_minSafe = value;}
	void setSafeMaximum(const double value){m_maxSafe = value;}
    bool isDanger();
    Qt::Orientation orientation();
    
    double  maxSafe(){  return m_maxSafe;  }
    double  minSafe(){ return m_minSafe;}
   
};

#endif // !defined(AFX_MPROGRESSBAR_H__4AD0DE49_EF59_4C06_BD8D_63E12F0111C5__INCLUDED_)
